package com.baoxin.chenxixc4coach.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashMap;
import java.util.Map;

/**
 * 考试学员
 */
public class TestStudent implements Parcelable {
    private String serId;
    private String serTrId;
    private String serExamTime;
    private String serFeild;
    private String serName;//考试名
    /**
     * null未设置 0缺考 1合格 -1未合格
     */
    private Integer serRes;

    /**
     * tr_name
     * tr_idnumber
     * tr_phone
     * tr_img
     */
    private Map<String, String> map;

    public String getSerId() {
        return serId;
    }

    public String getSerTrId() {
        return serTrId;
    }

    public String getSerExamTime() {
        return serExamTime;
    }

    public String getSerFeild() {
        return serFeild;
    }

    public String getSerName() {
        return serName;
    }

    public Integer getSerRes() {
        return serRes;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public TestStudent() {
    }

    public void setSerRes(Integer serRes) {
        this.serRes = serRes;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.serId);
        dest.writeString(this.serTrId);
        dest.writeString(this.serExamTime);
        dest.writeString(this.serFeild);
        dest.writeString(this.serName);
        dest.writeValue(this.serRes);
        dest.writeInt(this.map.size());
        for (Map.Entry<String, String> entry : this.map.entrySet()) {
            dest.writeString(entry.getKey());
            dest.writeString(entry.getValue());
        }
    }

    protected TestStudent(Parcel in) {
        this.serId = in.readString();
        this.serTrId = in.readString();
        this.serExamTime = in.readString();
        this.serFeild = in.readString();
        this.serName = in.readString();
        this.serRes = (Integer) in.readValue(Integer.class.getClassLoader());
        int mapSize = in.readInt();
        this.map = new HashMap<String, String>(mapSize);
        for (int i = 0; i < mapSize; i++) {
            String key = in.readString();
            String value = in.readString();
            this.map.put(key, value);
        }
    }

    public static final Creator<TestStudent> CREATOR = new Creator<TestStudent>() {
        @Override
        public TestStudent createFromParcel(Parcel source) {
            return new TestStudent(source);
        }

        @Override
        public TestStudent[] newArray(int size) {
            return new TestStudent[size];
        }
    };
}
